from Cube.game import CmdSendGet

GLOBALOBJECTFLAG = 0
LOCALOBJECTFLAG = 1

class QObjectBase:
    ObjectPool = None

    # override it
    def __init__(self, name="", flag=LOCALOBJECTFLAG):
        self.Name = name
        self.PoolFlag = flag
        self.ID = self.ObjectPool.Add(self, flag)
        self.CmdSend = CmdSendGet()

    # override it
    def DoDestroy(self):
        pass

# -------------------------------------------------------------------
    def ID2Obj(self, objID):
        ret = QObjectBase.ObjectGet(objID)
        return ret

    def destroy(self):
        self.ObjectPool.Remove(self)
        self.DoDestroy()
